<template>
  <div class="down_mian">
    <div class="down_wrap">
      <div>
      </div>
      <div>
        <el-table :data="leaselist" style="width: 100%">
          <el-table-column prop="goodsName" label="商品信息">
          </el-table-column>
          <el-table-column prop="sizeName" label="规格"> </el-table-column>
          <el-table-column prop="specialPrice" label="单价"> </el-table-column>
          <el-table-column prop="goodsCount" label="数量">
          </el-table-column>
          <el-table-column prop="nub" label="小计">
            <template slot-scope="scope">
              <div>{{ scope.row.goodsCount * scope.row.specialPrice }}</div>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button
                style="color: #ff0000"
                @click="hanldpath(scope.row)"
                type="text"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <el-table :data="data.guarateeGoodsItem" style="width: 100%">
          <el-table-column prop="goodsName" label="商品名称">
          </el-table-column>
          <el-table-column prop="sizeName" label="规格名称">
          </el-table-column>
          <el-table-column prop="sellingPrice" label="单价">
          </el-table-column>
          <el-table-column prop="goodsCount" label="商品数量">
          </el-table-column>
          <el-table-column
                  prop="sellingGuarantee"
                  label="商品保证金单价"
          ></el-table-column>
          <el-table-column label="商品总价">
            <template slot-scope="scope">
              {{ scope.row.sellingPrice * scope.row.goodsCount+ scope.row.sellingGuarantee * scope.row.goodsCount}}
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="detailed_foot">
        <div>
          租赁服务：已选择 1 个展位，费用合计：
          <span style="color: #ff0000">￥{{Price}}</span>
        </div>
        <div class="foot_but">
          <div style="margin-right: 20px">
            <el-button @click="hanldgo">返回</el-button>
          </div>
          <div>
            <el-button @click="hanldadd" type="danger">结算</el-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getToken,setToken } from "@/utils/auth";
import {
  getlist,
  stand_infoid,
  getshopcar,
  addahopcar,
  delshopcar
} from "@/api/lease/index";
export default {
  data() {
    return {
      leaselist: [
      ],
      Price:0,
      guarateeGoodsItem: [],
      fixedGoodsItem: [],
    };
  },
  created(){
    //  this.leaselist= this.$route.query.carlist
    this.getshopcar()
  },
  methods: {
    hanldgo() {
      this.$router.go(-1);
    },
    hanldadd() {
      this.$router.push("/liquidation");
    },
    // 购物车查询
    getshopcar() {
      let user = JSON.parse(getToken("user"));
      getshopcar(user.userId).then((res) => {
        this.leaselist = res.rows
        this.leaselist.forEach((item,index)=>{
          this.Price = item.specialPrice
        })
      });
    },
    // 列表删除
    hanldpath(row){
      delshopcar(row.sizeId).then(res=>{
        if (res.code == 200) {
          this.getshopcar()
            this.$message.success('删除商品成功')
        }
      });
    }
  },
};
</script>
<style scoped>
.down_mian {
  background-color: #f2f2f2;
  padding: 20px;
  min-height: 430px;
}
.down_wrap {
  width: 1100px;
  margin: auto;
  background-color: #fff;
  padding: 20px 20px 10px 20px;
  margin-bottom: 30px;
  border-bottom: 1px solid #f2f2f2;
}
/deep/.el-table th.el-table__cell {
  background-color: #f8fcfc !important;
  text-align: center !important;
}
/deep/.el-table td.el-table__cell,
.el-table th.el-table__cell.is-leaf {
  text-align: center !important;
}
.scope {
  display: flex;
}
.scope_img > img {
  width: 50px;
  object-fit: contain;
}
.detailed_foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
}
.foot_but {
  display: flex;
}
</style>